package com.wechat.page.chat;

import com.swak.fx.support.AbstractPage;
import com.swak.fx.support.FXMLView;

import javafx.fxml.FXML;
import javafx.scene.Parent;
import javafx.scene.layout.StackPane;

/**
 * ChatPage.
 * 
 * @author 618lf
 */
@FXMLView(title = "聊天", value = "ChatPage.fxml", css = "ChatPage.css")
public class ChatPage extends AbstractPage {

	@FXML
	private StackPane listPane;
	@FXML
	private StackPane chatPane;

	private ChatListPage chatListPage;
	private ChatContentPage chatContentPage;

	public ChatPage() {
		this.chatListPage = this.NewPage(ChatListPage.class);
		this.chatContentPage = this.NewPage(ChatContentPage.class);
	}

	@Override
	public void initializeParts() {
		super.initializeParts();
		this.initChatListPage();
		this.initChatContentPage();
	}

	private void initChatListPage() {
		Parent node = this.chatListPage.getRoot();
		this.listPane.getChildren().add(node);
	}

	private void initChatContentPage() {
		Parent node = this.chatContentPage.getRoot();
		this.chatPane.getChildren().add(node);
	}

	@Override
	public void setupBindings() {
		super.setupBindings();
		this.chatContentPage.activeProperty().bind(this.chatListPage.activeProperty());
		this.chatContentPage.refreshProperty().bind(this.chatListPage.refreshProperty());
	}
}